package com.fanshuai.spring.boot;

import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.List;

/**
 * Hello world!
 *
 */
public class App {
    public static void main(String[] args) throws Exception {
        StringBuilder b = new StringBuilder();

        List<String> list = Files.readAllLines(Paths.get("/Users/fanshuai/第二部分数据.csv"));
        int i = 0;
        for (String line : list) {
            if (i > 0) {
                String[] arr = line.split(",");
                long uid1 = Long.parseLong(arr[9]);
                long uid2 = Long.parseLong(arr[10]);
                String unionId = arr[13];

                if (uid2 != uid1) {
                    b.append("update user set status = 1 where user_id = ").append(uid2).append(";\n");
                    b.append("update user set union_id = \'" + unionId + "\' where user_id = ").append(uid1).append(";\n");
                }
            }
            i++;
        }

        System.out.println(b.toString());
    }
}
